home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
wipeab_1
/
form1.frm
< prev
next >
Wrap
Text File
|
1999-08-09
|
6KB
|
185 lines
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fest Einfach
Caption = "WIPE A BANNER OVER A BACKGROUND"
ClientHeight = 4575
ClientLeft = 45
ClientTop = 330
ClientWidth = 6450
ClipControls = 0 'False
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 305
ScaleMode = 3 'Pixel
ScaleWidth = 430
StartUpPosition = 3 'Windows-Standard
Begin VB.CheckBox Check1
Caption = "Transparent"
Height = 255
Left = 960
TabIndex = 5
Top = 0
Width = 1335
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "END"
Height = 375
Left = 0
TabIndex = 1
Top = 0
Width = 855
End
Begin VB.Timer Timer1
Interval = 20
Left = 4560
Top = 360
End
Begin VB.PictureBox OutPic
ClipControls = 0 'False
Height = 3015
Left = 0
ScaleHeight = 197
ScaleMode = 3 'Pixel
ScaleWidth = 197
TabIndex = 0
Top = 360
Width = 3015
End
Begin VB.Label Label4
Alignment = 2 'Zentriert
AutoSize = -1 'True
Caption = "NO OPENGL OR DIRECTX NEEDED ! JUST A FEW BITBLIT"
ForeColor = &H0000FFFF&
Height = 390
Left = 3120
TabIndex = 6
Top = 0
Width = 3255
WordWrap = -1 'True
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
BorderStyle = 1 'Fest Einfach
Caption = "Cool routine.. Load a picture and create a hdc.(invisible).. view it in module.bas"
Height = 375
Left = 0
TabIndex = 4
Top = 3840
Width = 6375
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
BorderStyle = 1 'Fest Einfach
Caption = "All you need is: one Picture.box a background.bmp , a logo.bmp to scroll and a timer"
Height = 255
Left = 0
TabIndex = 3
Top = 3480
Width = 6375
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "TOTAL FREEWARE questions and comments to RINGS@Online.de"
ForeColor = &H000000FF&
Height = 195
Left = 120
TabIndex = 2
Top = 4320
Width = 4950
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Wipe a banner transparently in a picture-Box
' another INFO for your Proggy
' based on different routines downloaded from PLANET-SOURCE-CODE.COM
' There is still more to do
' This version updated on 8/9/1999
' No Second-Picture-Box needed !!!
' coded by Siegfried Rings, RINGS@Online.de
' FULLY PublicDomain
Option Explicit
Private Sub Command1_Click()
End
End Sub
Private Sub Timer1_Timer()
Dim mode As Long
If Check1.Value = 1 Then mode = SRCAND
If Check1.Value = 0 Then mode = SRCCOPY
scrollbanner OutPic, Me, mode
End Sub
Sub scrollbanner(OutputPicture As Control, FMe As Form, mode As Long)
Static DoInitialize As Boolean
Static LogoDC As Long 'The sprite bitmap storage area
Static BackDC As Long 'The background bitmap storage
Static TempDC As Long
Static tmpval As Long
Static angle_x, angle_y, speed, i As Integer
Static MyXPointer, MyYPointer As Integer 'Banner moving in the Box
Dim bmp As Long
Static BannerW, BannerH As Integer
Dim w1, h1 As Integer
If DoInitialize = False Then
'First time calling , do some init (loading pictures and create's some Hdc
angle_x = 180 'logo x angle
angle_y = 60 'logo y angle
speed = 6 'spin speed
Call DirectLoadPicture("Banner5.bmp", LogoDC, bmp, BannerW, BannerH, FMe) 'Load Banner-picture and creates LOGODC
Call DirectLoadPicture("background1.bmp", BackDC, bmp, w1, h1, FMe) 'Load Backgroundpicture and creates BackDC
OutputPicture.Width = w1
OutputPicture.Height = h1
Call DirectLoadPicture("", TempDC, bmp, OutputPicture.Width, OutputPicture.Height, FMe) 'create work area
DoInitialize = True
End If
'the Logo moves from left to right
MyXPointer = MyXPointer + 2
If MyXPointer > OutputPicture.Width Then MyXPointer = -BannerW / 2
'And from top to bottom
MyYPointer = MyYPointer + 1
If MyYPointer > OutputPicture.Height Then MyYPointer = -BannerH
'now copy Background in temporary bitmap
tmpval = BitBlt(TempDC, 0, 0, OutputPicture.Width, OutputPicture.Height, BackDC, 0, 0, SRCCOPY) 'copy background to stage area
'there is room for more improvment for SIN-Scroller
For i = 1 To BannerW
'Copy Banner with sin-effect in temporary background
tmpval = BitBlt(TempDC, Cos(degtorad(angle_x + i)) * (BannerW / 4.25) + MyXPointer, Sin(degtorad(angle_y + i)) * 10 + 2.5 + MyYPointer, 1, BannerH, LogoDC, i, 0, mode) ' put spinning logo onto stage area
Next i
'Now copy temporary bitmap to output-Picture-Box
tmpval = BitBlt(OutputPicture.hDC, 0, 0, OutputPicture.Width, OutputPicture.Height, TempDC, 0, 0, SRCCOPY) ' copy stage to PictureBox
'any calculations follows
angle_x = angle_x + speed * 0.5 ' rotate logo x
angle_y = angle_y + speed * 2 ' rotate logo y
If angle_x >= 360 Then ' have we done a full rotation 360o??
angle_x = 0 ' Yep, reset angle
End If
If angle_x <= -180 Then ' have we done a full rotation 360o??
speed = speed * -1
End If
If angle_y >= 360 Then
angle_y = 0
End If
End Sub